/**
 * Created by Adi on 16/9/2.
 */
"use strict";

import { DeviceEventEmitter, NativeModules } from 'react-native';

const { Meglive, MegIDCard } = NativeModules;

const API_KEY = "pansky";
const API_SECRET = "R0vT-JxTZwxZdssawYLD0ECH63xoK68w";

export function initLive() {
	return Meglive.init();
}

/**
 *
 * {
 * 	"image":"file:///storage/emulated/0/Android/data/cn.com.pansky.sgss/cache/meglive",
 * 	"result":"验证成功",
 * 	"status":"success"
 * }
 * 启动活体认证
 */
export function detecting() {
	console.debug('=========XXXXXXX');
	return Meglive.detecting();

}

// ++++ 身份证扫描 +++++++++++++++++++++++++++++++++++  //

export function init() {
	return MegIDCard.init();
}

/**
 * {
 *   "avatar":"file:///storage/emulated/0/Android/data/cn.com.pansky.sgss/cache/idCardAvatar.png",
 *   "img":"file:///storage/emulated/0/Android/data/cn.com.pansky.sgss/cache/idCardFront.png"
 * }
 *
 * 扫描身份证正面
 * @param callback
 */
export function scanningFont() {
	return MegIDCard.scanningFont();
}

/**
 * {
 *   "img":"file:///storage/emulated/0/Android/data/cn.com.pansky.sgss/cache/idCardFront.png"
 * }
 * 扫描身份证背面
 * @param callback
 */
export function scanningBack() {
	return MegIDCard.scanningBack();
}

export default {initLive, detecting, init, scanningFont, scanningBack};